home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / lib / float / dpa_modf.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-09-09  |  416 b   |  26 lines

  1.  
  2. /*
  3.  *  DPA_MODF.C
  4.  *
  5.  *    (c)Copyright 1992-1997 Obvious Implementations Corp.  Redistribution and
  6.  *    use is allowed under the terms of the DICE-LICENSE FILE,
  7.  *    DICE-LICENSE.TXT.
  8.  *
  9.  *  double frac = modf(double value, double *ip);
  10.  */
  11.  
  12. #include <math.h>
  13.  
  14. double
  15. modf(value, ip)
  16. double value;
  17. double *ip;
  18. {
  19.     if (value >= 0.0)
  20.     *ip = floor(value);
  21.     else
  22.     *ip = ceil(value);
  23.     return(value - *ip);
  24. }
  25.  
  26.